home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 31
/
Aminet 31 (1999)(Schatztruhe)[!][Jun 1999].iso
/
Aminet
/
dev
/
gui
/
gui4cli.lha
/
Gui4Cli
/
Dir
/
dir.gcview
< prev
next >
Wrap
Text File
|
1999-04-21
|
7KB
|
312 lines
G4C
; dir.gcview - by dck January 1999
; A GUI for GCView - gcview should be in guis:c/gcview
WINBIG 180 15 200 166 "GCView 1.0 by dck@hol.gr"
WinType 11110001
xOnLoad
; start gcview
ifexists port ~gcview
run 'guis:ext/view/gcview'
wait port gcview 50
if $$retcode > 0
EZReq "Guis:c/GCView not found!" "OK" ""
guiquit #this
stop
endif
endif
setgad #this 33 hide
mode = FILES
gosub #this FileMode
guiopen #this
xOnClose
guiquit #this
call gcview quit force
xRoutine FileMode ; change gui to file list
setgad #this 1/13 HIDE
setgad #this 21/25 SHOW
redraw #this
xRoutine ConvertMode ; change gui to options gadgets
setgad #this 1/13 SHOW
setgad #this 21/25 HIDE
redraw #this
XCYCLER 0 0 200 14 "" mode ; cycler to choose the mode
cstr "Choose/Add Files" FILES
Cstr "Converting Options" CONVERT
if $mode = CONVERT
gosub #this ConvertMode
else
gosub #this FileMode
endif
;------------------ PRETTY OBVIOUS OPTIONS GADGETS
; XCYCLER 70 15 125 14 Format format
; GadID 1
; cstr ILBM ILBM
; cstr GIF GIF
; cstr JPEG JPEG
; cstr PCX PCX
; cstr PostScript Postscript
; cstr RGB-Raw RGB-Raw
; XCYCLER 70 30 125 14 Colors colors
; GadId 2
; cstr Default ""
; cstr 16 16
; cstr 32 32
; cstr 128 128
; cstr 256 256
; cstr 2 2
; cstr 4 4
; cstr 8 8
; XCYCLER 70 45 125 14 Type bw
; GadId 3
; cstr Default ""
; cstr GRAYSCALE GRAYSCALE
; cstr BW BW
; cstr INVERT INVERS
; cstr "NO Red" NORED
; cstr "NO Green" NOGREEN
; cstr "NO Blue" NOBLUE
; XCYCLER 70 60 125 14 Flip flip
; gadid 11
; Cstr None ""
; cstr "Flip X" FLIPX
; cstr "Filp Y" FLIPY
; cstr "Flip XY" "FLIPX FLIPY"
; XCYCLER 70 75 125 14 Rotate rot
; gadid 12
; cstr None ""
; cstr "90 Left" ROTATELEFT
; cstr "90 Right" ROTATERIGHT
; ; NOT IMPLEMENTED YET
; ; slider contrast CONTRAST 0-100
; ; slider brightness BRIGHTNESS 0-255
;---- Size
; XCYCLER 70 90 125 14 Size size
; gadid 4
; cstr Same ""
; cstr BOXFIT BOXFIT
; cstr SIZE SIZE
; if $size = NONE
; setgad #this 5 OFF
; setgad #this 6 OFF
; else
; setgad #this 5 ON
; setgad #this 6 ON
; endif
; ; -- Size textin gadgets
; XTEXTIN 70 105 61 14 "" x 320 10
; gadid 5
; SetGad #this 6 ON
; XTEXTIN 135 105 59 14 "" y 250 10
; gadid 6
; -------------------- Status Boxes
TEXT 5 112 40 10 "Status:" 20 NOBOX
gadid 7
TEXT 4 123 190 12 "No Files" 130 BOX
GadID 8
Gauge 4 136 190 12 IN BUTTON 3 0 0
gadid 13
;--------------------- LISTVIEW SHOWING FILES TO CONVERT
XLISTVIEW 0 15 198 132 "" cfile "" 10 MULTI
gadid 21
XBUTTON 0 150 50 14 View
gadid 25
lvuse #this 21
lvmulti first
while $$lv.line > ""
*RUNMODE = 'run >nil:'
*FILENAME = $file
gosub viewfile.g ViewFile
lvmulti next
endwhile
XBUTTON 50 150 50 14 Add ; add files selected from dir.gc
gadid 22
gui = $$lv.gui
id = $$lv.id
if $$lv.mode != DIR
ezreq 'Please choose files from\na Directory Listview!' Ok ''
stop
endif
lvmulti first
var = \$$$lv.var
while $$lv.line > ""
if $var H= 'FORM????ILBM' ; IFF
or $var H= "??????JFIF" ; JPEG
or $var H= "ÿØÿÄ" ; JPEG
or $var H= "GIF" ; GIF
or $var H= "?PNG" ; PNG
lvuse #this 21
lvadd $var
lvuse $gui $id
endif
lvmulti off
lvmulti next
endwhile
XBUTTON 100 150 50 14 Del ; delete selected files
gadid 23
lvuse #this 21
lvmulti first
while $$lv.line > ""
lvdel -1
lvmulti first ; use first again since last first was deleted
endwhile
XBUTTON 150 150 50 14 Clr
gadid 24
lvuse #this 21
lvclear
; -------------------------------------------------------------------
;-------------------- Abort
; -------------------------------------------------------------------
XBUTTON 100 150 95 14 Abort
gadid 9
stopflag = 1
; -------------------------------------------------------------------
;-------------------- Start converting
; -------------------------------------------------------------------
XBUTTON 5 150 95 14 "Convert"
gadid 10
gadfont #screen 8 010
; load my palette
call gcview load SQ0:Data/Art/PALETTE/Palette-Grn16 mypal palette
; create a palette
call gcview create picpal 0 0 8
lvuse #this 21
lvmulti all
count = 0
stopflag = 0
total = $$lv.tot
update #this 13 0 ; gauge
lvmulti first
gosub #this nextfile
; -------------------------------------------------------------------
; ---------------------- CALLED for each file
; -------------------------------------------------------------------
XLISTVIEW 0 15 198 132 "" com "" 0 MULTI ; used to construct batch file
gadid 33
xROUTINE nextfile
update #this 13 $(($count / $total) * 100) ; gauge
lvuse #this 21
if $$lv.line > ""
and $stopflag = 0
update #this 7 Converting:
update #this 8 'File: $cfile'
lvuse #this 33
lvclear
lvadd 'GCVU'
lvadd 'load $cfile pic'
; set picture palette & overlay mine
lvadd 'set palette picpal pic'
lvadd 'set palette picpal mypal'
lvadd 'rexx Gui4Cli "update dir.gcview 8 Remapping.."'
lvadd 'remap pic picpal'
lvadd 'set palette pic picpal'
; DELETE OLD FILE !!!!! REMOVE THIS ###### !!!!!
; update #this 8 'Deleting old file..'
; action delete $cfile noreq ; No pattern matching!!
extract cfile ext fext
if $fext == .iff
newext = '2.iff'
else
newext = '.iff'
endif
searchvar cfile $fext cs first
c = $$search.pos
extract cfile unquote cfile
cfile[$c] = $newext
lvadd 'rexx Gui4Cli "update dir.gcview 8 Saving.."'
lvadd 'set mode pic 0x00029004'
lvadd 'save pic $cfile'
lvadd 'unload pic'
++count ; update gauge
; notify us when finished
lvadd 'rexx Gui4Cli "gosub dir.gcview nextfile"'
; execute the listview file
lvsave T:gcCom
call gcview execute T:gcCom
lvuse #this 21
lvmulti off
lvmulti next
else
call gcview unload picpal
call gcview unload mypal
if $stopflag = 1
update #this 7 Aborted:
else
update #this 7 Status:
endif
update #this 8 'Converted $count files'
endif
; -------------------------------------------------------------------
; ERROR --- This is where we'll end up if anything goes wrong..
; -------------------------------------------------------------------
xOnFail
EZReq "An error occured.\nClick on Convert to continue." "OK" ""